package com.yanqu.road.server.cmd.activity.feast;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ShanHeFeastProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.feast.CrossFeastMgr;
import com.yanqu.road.server.manager.activity.feast.activity.CrossFeastActivity;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameErrorCode;

@Cmd(code = CrossProtocol.C_CROSS_SHAN_HE_FEAST_GET_PVP_END_DATA, desc = "跨服取下pvp结束数据")
public class CrossFeastGetPvpEndDataCmd extends CrossCommand {

    private int activityId;

    private long userId;

    private int endRound;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ShanHeFeastProto.CrossFeastGetPvpEndDataReqMsg reqMsg = ShanHeFeastProto.CrossFeastGetPvpEndDataReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        userId = packet.getPlayerId();
        endRound = reqMsg.getEndRound();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossFeastActivity activity = CrossFeastMgr.getActivity(activityId);
        if (activity == null) {
            ret = GameErrorCode.E_SHAN_HE_FEAST_ACTIVITY_NOT_FOUND;
            return;
        }
        ret = activity.getPvpEndData(serverId, userId, endRound);
    }

    @Override
    public void sendData() {

    }
}
